/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fwdisp.gui.tabs.settings;

import fwdisp.gui.moduls.SecRowPanel;
import java.awt.GridLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import settings.MainSettingsManager;
import settings.collections.ControllCenterSettings;
import settings.collections.elements.ControllCenter;

/**
 *
 * @author rbs
 */
public class AnalyticalSettingsPanel extends SecRowPanel{

    private static ControllCenterSettings centerSettings = MainSettingsManager.getControlCenterSettings();
    private static JComboBox centerSelect;
    
    public AnalyticalSettingsPanel() {
        setName("Analyse");
        setVisible(true);
        JLabel info = new JLabel("<html>Aufgrund einer kleinen Nutzeranzahl wird hier auf eine allgemeine Auswertung aller möglichen FME-Meldungen verzichtet. Ich biete zur Zeit folgende verfügbaren Regionen an. Ich nehme gern per Mail Wünsche für weitere Regionen entgegen.");
        String[] items = new String[ControllCenter.values().length];
        int i = 0;
        for (ControllCenter center: ControllCenter.values())
        {
            items[i] = center.toString();
            i++;
        }
        centerSelect = new JComboBox(items);
        
        
        ControllCenter center = centerSettings.getCenter();
        centerSelect.setSelectedIndex(center.ordinal());
        
        
        
        centerSelect.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                centerSettings.setCenter(ControllCenter.values()[centerSelect.getSelectedIndex()]);
            }
            
        });
        
        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        
        setLayout(new GridLayout(10, 1));
        add(info);
        add(centerSelect);
    }
}
